using System;
using System.Data;
using System.Runtime.Serialization;
using System.Collections.Generic;

namespace MediaForce.Client.Common.DataContracts
{
    public enum ResponseStatus { None = 0, OK = 1, Error = 2 }

    [DataContract]
    [Serializable]
    public class OperationResponse
    {
        [EnumMember]
        private ResponseStatus _responseStatus;
        [DataMember]
        public ResponseStatus ResponseStatus
        {
            get { return _responseStatus; }
            set
            {
                _responseStatus = value;
            }
        }

        private DataTable _resultData;
        [DataMember]
        public DataTable ResultData 
        {
            get
            {
                return _resultData;
            }
            set
            
            {
                _resultData = value;
            }
        }
        private string _errorMessage;
        [DataMember]
        public string ErrorMessage
        {
            get
            {
                return _errorMessage;
            }
            set
            {
                _errorMessage = value;
            }
        }

        /// <summary>
        /// Indicate that an error occurred
        /// </summary>
        /// <param name="errorMessage">The error message</param>
        /// <returns>The current object</returns>
        public OperationResponse SetError(string errorMessage)
        {
            _responseStatus = ResponseStatus.Error;
            _errorMessage = errorMessage;

            return this;
        }
    }

    

}
